<?php
/* Smarty version 4.0.0-rc.0, created on 2021-11-04 14:49:05
  from 'D:\phpstudy_pro\WWW\templates\3-demo.html' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.0.0-rc.0',
  'unifunc' => 'content_618382612a4ce7_42018042',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    'd98a774445d355cfce0846f1ee9f39e3b734224a' => 
    array (
      0 => 'D:\\phpstudy_pro\\WWW\\templates\\3-demo.html',
      1 => 1636008543,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_618382612a4ce7_42018042 (Smarty_Internal_Template $_smarty_tpl) {
?><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		for循环：<br>
		<?php
$_smarty_tpl->tpl_vars['i'] = new Smarty_Variable(null, $_smarty_tpl->isRenderingCache);$_smarty_tpl->tpl_vars['i']->step = 1;$_smarty_tpl->tpl_vars['i']->total = (int) ceil(($_smarty_tpl->tpl_vars['i']->step > 0 ? 5+1 - (1) : 1-(5)+1)/abs($_smarty_tpl->tpl_vars['i']->step));
if ($_smarty_tpl->tpl_vars['i']->total > 0) {
for ($_smarty_tpl->tpl_vars['i']->value = 1, $_smarty_tpl->tpl_vars['i']->iteration = 1;$_smarty_tpl->tpl_vars['i']->iteration <= $_smarty_tpl->tpl_vars['i']->total;$_smarty_tpl->tpl_vars['i']->value += $_smarty_tpl->tpl_vars['i']->step, $_smarty_tpl->tpl_vars['i']->iteration++) {
$_smarty_tpl->tpl_vars['i']->first = $_smarty_tpl->tpl_vars['i']->iteration === 1;$_smarty_tpl->tpl_vars['i']->last = $_smarty_tpl->tpl_vars['i']->iteration === $_smarty_tpl->tpl_vars['i']->total;?>
			<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
:锄禾日当午<br>
		<?php }
}
?>
		<hr>
		<?php
$_smarty_tpl->tpl_vars['i'] = new Smarty_Variable(null, $_smarty_tpl->isRenderingCache);$_smarty_tpl->tpl_vars['i']->step = 2;$_smarty_tpl->tpl_vars['i']->total = (int) ceil(($_smarty_tpl->tpl_vars['i']->step > 0 ? 5+1 - (1) : 1-(5)+1)/abs($_smarty_tpl->tpl_vars['i']->step));
if ($_smarty_tpl->tpl_vars['i']->total > 0) {
for ($_smarty_tpl->tpl_vars['i']->value = 1, $_smarty_tpl->tpl_vars['i']->iteration = 1;$_smarty_tpl->tpl_vars['i']->iteration <= $_smarty_tpl->tpl_vars['i']->total;$_smarty_tpl->tpl_vars['i']->value += $_smarty_tpl->tpl_vars['i']->step, $_smarty_tpl->tpl_vars['i']->iteration++) {
$_smarty_tpl->tpl_vars['i']->first = $_smarty_tpl->tpl_vars['i']->iteration === 1;$_smarty_tpl->tpl_vars['i']->last = $_smarty_tpl->tpl_vars['i']->iteration === $_smarty_tpl->tpl_vars['i']->total;?>
			<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
:锄禾日当午<br>
		<?php }
}
?>
		<hr>
		while循环：<br>
		<?php $_smarty_tpl->_assignInScope('i', 1);?>
		<?php
 while ($_smarty_tpl->tpl_vars['i']->value <= 5) {?>
			<?php echo $_smarty_tpl->tpl_vars['i']->value++;?>
:锄禾日当午<br>
		<?php }?>

		<hr>
		foreach循环：<br>
		<table border="1" bordercolor="#000" width="780">
			<tr>
				<th>是否是第一个元素</th>
				<th>索引</th>
				<th>编号</th>
				<th>键</th>
				<th>值</th>
				<th>是否是最后一个元素</th>
			</tr>
			<?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['stu']->value, 'v', true, 'k');
$_smarty_tpl->tpl_vars['v']->iteration = 0;
$_smarty_tpl->tpl_vars['v']->index = -1;
$_smarty_tpl->tpl_vars['v']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['k']->value => $_smarty_tpl->tpl_vars['v']->value) {
$_smarty_tpl->tpl_vars['v']->do_else = false;
$_smarty_tpl->tpl_vars['v']->iteration++;
$_smarty_tpl->tpl_vars['v']->index++;
$_smarty_tpl->tpl_vars['v']->first = !$_smarty_tpl->tpl_vars['v']->index;
$_smarty_tpl->tpl_vars['v']->last = $_smarty_tpl->tpl_vars['v']->iteration === $_smarty_tpl->tpl_vars['v']->total;
$__foreach_v_0_saved = $_smarty_tpl->tpl_vars['v'];
?>
			<tr>
				<td><?php echo $_smarty_tpl->tpl_vars['v']->first;?>
</td>
				<td><?php echo $_smarty_tpl->tpl_vars['v']->index;?>
</td>
				<td><?php echo $_smarty_tpl->tpl_vars['v']->iteration;?>
</td>
				<td><?php echo $_smarty_tpl->tpl_vars['k']->value;?>
</td>
				<td><?php echo $_smarty_tpl->tpl_vars['v']->value;?>
</td>
				<td><?php echo $_smarty_tpl->tpl_vars['v']->last;?>
</td>
			</tr>
			<?php
$_smarty_tpl->tpl_vars['v'] = $__foreach_v_0_saved;
}
if ($_smarty_tpl->tpl_vars['v']->do_else) {
?>
			没有数组输出
			<?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
		</table>

		<hr>
		section循环：<br>
		<table border="1" bordercolor="#000" width="780">
			<tr>
				<th>是否是第一个元素</th>
				<th>索引</th>
				<th>编号</th>
				<th>值</th>
				<th>是否是最后一个元素</th>
			</tr>
			<?php
$__section_s_0_loop = (is_array(@$_loop=$_smarty_tpl->tpl_vars['stu1']->value) ? count($_loop) : max(0, (int) $_loop));
$__section_s_0_total = $__section_s_0_loop;
$_smarty_tpl->tpl_vars['__smarty_section_s'] = new Smarty_Variable(array());
if ($__section_s_0_total !== 0) {
for ($_smarty_tpl->tpl_vars['__smarty_section_s']->value['iteration'] = 1, $_smarty_tpl->tpl_vars['__smarty_section_s']->value['index'] = 0; $_smarty_tpl->tpl_vars['__smarty_section_s']->value['iteration'] <= $__section_s_0_total; $_smarty_tpl->tpl_vars['__smarty_section_s']->value['iteration']++, $_smarty_tpl->tpl_vars['__smarty_section_s']->value['index']++){
$_smarty_tpl->tpl_vars['__smarty_section_s']->value['first'] = ($_smarty_tpl->tpl_vars['__smarty_section_s']->value['iteration'] === 1);
$_smarty_tpl->tpl_vars['__smarty_section_s']->value['last'] = ($_smarty_tpl->tpl_vars['__smarty_section_s']->value['iteration'] === $__section_s_0_total);
?>
			<tr>
				<td><?php echo (isset($_smarty_tpl->tpl_vars['__smarty_section_s']->value['first']) ? $_smarty_tpl->tpl_vars['__smarty_section_s']->value['first'] : null);?>
</td>
				<td><?php echo (isset($_smarty_tpl->tpl_vars['__smarty_section_s']->value['index']) ? $_smarty_tpl->tpl_vars['__smarty_section_s']->value['index'] : null);?>
</td>
				<td><?php echo (isset($_smarty_tpl->tpl_vars['__smarty_section_s']->value['iteration']) ? $_smarty_tpl->tpl_vars['__smarty_section_s']->value['iteration'] : null);?>
</td>
				<td><?php echo $_smarty_tpl->tpl_vars['stu1']->value[(isset($_smarty_tpl->tpl_vars['__smarty_section_s']->value['index']) ? $_smarty_tpl->tpl_vars['__smarty_section_s']->value['index'] : null)];?>
</td>
				<td><?php echo (isset($_smarty_tpl->tpl_vars['__smarty_section_s']->value['last']) ? $_smarty_tpl->tpl_vars['__smarty_section_s']->value['last'] : null);?>
</td>
			</tr>
			<?php }} else {
 ?>
			没有数组输出
			<?php
}
?>
		</table>


	</body>
</html>
<?php }
}
